<template>
  <div>
    <template v-if="$app.judgeData(orderInfo) && $app.judgeData(orLiInfo)">
      <Card class="marginB10">

        <!-- aTopType 1专利 2商标 3版权 -->
        <ATopBase :orderInfo="orderInfo" :orLiInfo="orLiInfo" :aTopType="3"/>

        <div class="overflowH " style="padding:0 40px;" >
          <template v-if="orderInfo.state==0">
            <Steps :current="stateIng" class="marginB20">
              <Step title="创建订单"></Step>
              <Step :title="orderInfo.state_name"></Step>
            </Steps>
          </template>
          <template v-else>
            <Steps :current="stateIng" class="marginB20">
              <Step title="创建订单"></Step>
              <Step title="已付款"></Step>
              <Step :title="orderInfo.state==6?'待补正':'资料审核中'"></Step>
              <Step title="版权中心已受理"></Step>
              <Step title="已下证"></Step>
            </Steps>
          </template>

          <OdUl :list="orderInfo.state_log" />
          
        </div>

        <div class="clearBoth " :class="(orderInfo.state==0 || orderInfo.state==1|| orderInfo.state==2)?' padding5 ' :' '"></div>

        <template v-if="orderInfo.state==0||orderInfo.state==1||orderInfo.state==2" >
          <div class="TJ_big marginB10 paddingT10">
            <template v-if="orderInfo.state==0||orderInfo.state==1">
              <Button type="default" class="marginR10" @click="$app.delOrderOk(orLiInfo.id)">
                <Icon type="ios-trash" size="18" class="cCCC relative marginR5"  />删 除
              </Button>
            </template>
            <template v-if="orderInfo.state==1||orderInfo.state==2">
              <Button type="primary" ghost class="marginR10" @click="ttW">
                <Icon type="ios-create-outline" size="18" class="relative marginR5"  />
                修改订单
              </Button>
            </template>
            <template v-if="orderInfo.state==1">
              <Button type="primary" class="marginR30" @click="zFu">
                <Icon type="logo-yen" size="14" class="relative marginR5"  />
                付 款
              </Button>
            </template>
          </div>
        </template>
      </Card>

      <template v-if="$app.judgeData(orderInfo.bz_list)">
        <Card class="marginB10">
          <Bz_list :orderInfo="orderInfo" :orLiInfo="orLiInfo" />
        </Card>
      </template>

      <!-- 已下单未付款 -->
      <template v-if="orderInfo.state==1">
        <!-- 下单成功支付框 -->
        <PayBox ref="payBox" :noOrderList="true" />
      </template>

    </template>

  </div>
</template>



<script>
import Bz_list from "./plugin/bz_list";
import PayBox from "@$@/_service/payBox";
import OdUl from "../common/plugin/odUl";

// 基础订单数据-当前进度
import ATopBase from "@$@/_orderInfo/aTop/aTopBase";

export default {
  name: "aTop",
  components: { PayBox, OdUl,Bz_list,ATopBase },
  props: ["orderInfo", "orLiInfo"],
  data() {
    let data = {
      stateIng: 0 //当前进度
    };
    let tool = {};
    return Object.assign(data, tool);
  },
  watch: {
    orderInfo(newVal, oldVal) {
      let { state } = newVal;

      switch (parseInt(state)) {
        case 0:
          this.stateIng = 1;
          break;
        case 1:
          this.stateIng = 0;
          break;
        case 2:
          this.stateIng = 1;
          break;
        case 3:
        case 4:
        case 5:
        case 6:
        case 7:
        case 8:
          this.stateIng = 2;
          break;
        case 9:
          this.stateIng = 3;
          break;
        case 10:
          this.stateIng = 4;
          break;
      }
    }
  },
  mounted() {
  },
  methods: {
    ttW() {
      $app.goEdit(this);//跳转编辑
    },
    zFu() {
      let {
        $route: {
          query: { order_id }
        },
        orderInfo:{
          state
        }
      } = this;
      $app.payBoxShow(this, order_id,{
        payFun:() => {
          this.$parent.getData();//调用父亲初始化数据方法
        }
      });
    }
  }
};
</script>

